package Io;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Test5 {
    //字节流复制图片
    public static void main(String[] args) {
        Test4.copyFile("D:\\aa\\a\\gxy1.jpg","D:\\aa\\a\\b\\guxinyu.jpg");
    }
    public static void copyFile(String inpath,String outpath){
        try {
            FileInputStream in =new FileInputStream(inpath);
            FileOutputStream out=new FileOutputStream(outpath);
            byte[] b=new byte[100];
            int len=0;
            while ((len=in.read(b))!=-1){
                out.write(b,0,len);
            }
            out.flush();//把内存的数据刷到硬盘
            out.close();
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
